Component({
  properties: {
    assets: {
      type: Array,
      value: []
    },
    assetsIds: {
      type: Array,
      value: []
    }
  },

  data: {
    selectedIds: []
  },

  observers: {

    //监听数组内容变化
    'assetsIds': function (assetsIds) {
      console.log('asset2dsafsdsIds:', assetsIds)
      this.setData({
        selectedIds: assetsIds
      })
    }
  },

  methods: {
    onCheckChange(event) {
      const selectedId = event.detail;
      // 遍历所有资产，找出选中的资产
      const selectedAssets = this.properties.assets.filter(item => selectedId.includes(String(item.id)));

      this.setData({
        selectedIds: selectedId
      });

      // // 触发事件，将选中的 item 对象数组传递出去
      this.triggerEvent('changes', { selectedAssets });

      console.log(this.properties.assetsIds,78766)
    }
  }
});